package org.example.day20240829Calendar.homeWork;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws ParseException {
        Scanner scanner = new Scanner(System.in);
        int yearInput = scanner.nextInt();
        int dayInput = scanner.nextInt();

        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR,yearInput);
        calendar.set(Calendar.MONTH,0);
        calendar.set(Calendar.DATE,0);
        calendar.add(Calendar.DATE,dayInput);

        int day = calendar.get(Calendar.DATE);
        int month = calendar.get(Calendar.MONTH);

        System.out.println(month+1);
        System.out.println(day);
    }
}
